package com.lzy.huijinjiazu.mvp.ui.adapter;

import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jess.arms.utils.ArmsUtils;
import com.lzy.huijinjiazu.R;

/**
 * Created by long on 2018/1/11.
 */

public class ExtravagantClassifAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public ExtravagantClassifAdapter() {
        super(R.layout.item_extravagan_classif);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        LinearLayout itemView = (LinearLayout) helper.itemView;
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.rightMargin = (helper.getLayoutPosition() + 1) % 3 == 0 ? 0 : ArmsUtils.dip2px(mContext, 5);
        params.bottomMargin=getItemCount()/2>=(helper.getLayoutPosition()+1)?ArmsUtils.dip2px(mContext,5):0;
        itemView.setLayoutParams(params);
    }
}
